mi = (r2 < wthresh0 && mi == -1)*0 + (r2 >= wthresh0 || mi != -1)*mi;
mi = (r2 < wthresh1 && mi == -1)*1 + (r2 >= wthresh1 || mi != -1)*mi;
mi = (r2 < wthresh2 && mi == -1)*2 + (r2 >= wthresh2 || mi != -1)*mi;
mi = (r2 < wthresh3 && mi == -1)*3 + (r2 >= wthresh3 || mi != -1)*mi;
mi = (r2 < wthresh4 && mi == -1)*4 + (r2 >= wthresh4 || mi != -1)*mi;
mi = (r2 < wthresh5 && mi == -1)*5 + (r2 >= wthresh5 || mi != -1)*mi;
mi = (r2 < wthresh6 && mi == -1)*6 + (r2 >= wthresh6 || mi != -1)*mi;
mi = (r2 < wthresh7 && mi == -1)*7 + (r2 >= wthresh7 || mi != -1)*mi;
mi = (r2 < wthresh8 && mi == -1)*8 + (r2 >= wthresh8 || mi != -1)*mi;
mi = (r2 < wthresh9 && mi == -1)*9 + (r2 >= wthresh9 || mi != -1)*mi;
mi = (r2 < wthresh10 && mi == -1)*10 + (r2 >= wthresh10 || mi != -1)*mi;
mi = (r2 < wthresh11 && mi == -1)*11 + (r2 >= wthresh11 || mi != -1)*mi;
mi = (r2 < wthresh12 && mi == -1)*12 + (r2 >= wthresh12 || mi != -1)*mi;
mi = (r2 < wthresh13 && mi == -1)*13 + (r2 >= wthresh13 || mi != -1)*mi;
mi = (r2 < wthresh14 && mi == -1)*14 + (r2 >= wthresh14 || mi != -1)*mi;
mi = (r2 < wthresh15 && mi == -1)*15 + (r2 >= wthresh15 || mi != -1)*mi;
mi = (r2 < wthresh16 && mi == -1)*16 + (r2 >= wthresh16 || mi != -1)*mi;
mi = (r2 < wthresh17 && mi == -1)*17 + (r2 >= wthresh17 || mi != -1)*mi;
mi = (r2 < wthresh18 && mi == -1)*18 + (r2 >= wthresh18 || mi != -1)*mi;
mi = (r2 < wthresh19 && mi == -1)*19 + (r2 >= wthresh19 || mi != -1)*mi;
mi = (r2 < wthresh20 && mi == -1)*20 + (r2 >= wthresh20 || mi != -1)*mi;
mi = (r2 < wthresh21 && mi == -1)*21 + (r2 >= wthresh21 || mi != -1)*mi;
mi = (r2 < wthresh22 && mi == -1)*22 + (r2 >= wthresh22 || mi != -1)*mi;
mi = (r2 < wthresh23 && mi == -1)*23 + (r2 >= wthresh23 || mi != -1)*mi;
mi = (r2 < wthresh24 && mi == -1)*24 + (r2 >= wthresh24 || mi != -1)*mi;
mi = (r2 < wthresh25 && mi == -1)*25 + (r2 >= wthresh25 || mi != -1)*mi;
mi = (r2 < wthresh26 && mi == -1)*26 + (r2 >= wthresh26 || mi != -1)*mi;
mi = (r2 < wthresh27 && mi == -1)*27 + (r2 >= wthresh27 || mi != -1)*mi;
mi = (r2 < wthresh28 && mi == -1)*28 + (r2 >= wthresh28 || mi != -1)*mi;
mi = (r2 < wthresh29 && mi == -1)*29 + (r2 >= wthresh29 || mi != -1)*mi;
mi = (r2 < wthresh30 && mi == -1)*30 + (r2 >= wthresh30 || mi != -1)*mi;
mi = (r2 < wthresh31 && mi == -1)*31 + (r2 >= wthresh31 || mi != -1)*mi;
mi = (r2 < wthresh32 && mi == -1)*32 + (r2 >= wthresh32 || mi != -1)*mi;
mi = (r2 < wthresh33 && mi == -1)*33 + (r2 >= wthresh33 || mi != -1)*mi;
mi = (r2 < wthresh34 && mi == -1)*34 + (r2 >= wthresh34 || mi != -1)*mi;
mi = (r2 < wthresh35 && mi == -1)*35 + (r2 >= wthresh35 || mi != -1)*mi;
mi = (r2 < wthresh36 && mi == -1)*36 + (r2 >= wthresh36 || mi != -1)*mi;
mi = (r2 < wthresh37 && mi == -1)*37 + (r2 >= wthresh37 || mi != -1)*mi;
mi = (r2 < wthresh38 && mi == -1)*38 + (r2 >= wthresh38 || mi != -1)*mi;
mi = (r2 < wthresh39 && mi == -1)*39 + (r2 >= wthresh39 || mi != -1)*mi;
mi = (r2 < wthresh40 && mi == -1)*40 + (r2 >= wthresh40 || mi != -1)*mi;
mi = (r2 < wthresh41 && mi == -1)*41 + (r2 >= wthresh41 || mi != -1)*mi;
